import 'package:flutter/material.dart';

class DrawerCustom extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Drawer(
      child: new ListView(
        children: <Widget>[
          new _UserAccountsDrawerHeaderCustom(),
          new ListTile(
            title: new Text('个人中心'),
            leading: new Icon(Icons.person),
            trailing: new Icon(
              Icons.arrow_forward_ios,
              size: 16,
            ),
            onTap: () => Navigator.pop(context),
          ),
          new ListTile(
            title: new Text('设置'),
            leading: new Icon(Icons.settings),
            trailing: new Icon(
              Icons.arrow_forward_ios,
              size: 16,
            ),
            onTap: () => Navigator.pop(context),
          ),
        ],
      ),
    );
  }
}

class _UserAccountsDrawerHeaderCustom extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new UserAccountsDrawerHeader(
      accountName: new Text('anxu'),
      accountEmail: new Text('anxu1212@hotmail.com'),
      currentAccountPicture: new CircleAvatar(
        backgroundImage: NetworkImage(
            'https://pic1.zhimg.com/v2-e76be40e4cbd084138b286a35ef44e5b_r.jpg'),
      ),
      decoration: BoxDecoration(
        color: Colors.yellow[400],
        image: DecorationImage(
          fit: BoxFit.fill,
          colorFilter: ColorFilter.mode(
            Colors.yellow[400].withOpacity(0.6),
            BlendMode.srcOver,
          ),
          image: NetworkImage(
              'https://t7.baidu.com/it/u=4162611394,4275913936&fm=193'),
        ),
      ),
      onDetailsPressed: () => {Navigator.pop(context)},
    );
  }
}
